package visitor.pattern.mysonar;

import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @Author: Coderlyz
 * @Date: 2023/4/13 14:58
 */
@Slf4j
public class Problems {
    private static ArrayList problemList = new ArrayList<Problems>();
    private int line;
    private String description;

    public Problems(){};

    public Problems(int line,String description){
        this.line = line;
        this.description = description;
    }

    public void addProblem(int line,String description){
        log.debug("发现并添加问题：" + line + "行");
        this.problemList.add(new Problems(line,description));
    }

    public void showProbles(){
        if (problemList.size() == 0)log.debug("everything is ok");
        else {
            for (Object pro : problemList){
                Problems p = (Problems)pro;
                log.debug(p.toString());
            }
        }
//        ThreadPoolExecutor d = new ThreadPoolExecutor();
    }


    @Override
    public String toString() {
        return "line: " + line +
                ", description: '" + description + '\'';
    }
}
